package com.guigu.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.ZhucheService;
import com.guigu.mapper.ZhucheMapper;
import com.guigu.pojo.FrontUser;
import com.guigu.pojo.SysUser;
import com.guigu.vo.Pojo;
import com.guigu.vo.Vo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class ZhucheServiceImpl extends ServiceImpl<ZhucheMapper, FrontUser> implements ZhucheService {
@Autowired
private ZhucheMapper zhucheMapper;

    @Override
    public Integer selectByAccount(FrontUser frontUser) {
        return zhucheMapper.selectByAccount(frontUser);
    }

    @Override
    public Integer selectByAccount1(SysUser sysUser) {
        return zhucheMapper.selectByAccount1(sysUser);
    }

    @Override
    public SysUser selectById(int uid) {
        return zhucheMapper.selectById(uid);
    }
    @Override
    public Integer selectById1(FrontUser frontUser) {
        return zhucheMapper.selectById1(frontUser);
    }
    @Override
    public Integer updatePassword(FrontUser frontUser) {
        return zhucheMapper.updatePassword(frontUser);
    }

    @Override
    public Pojo<FrontUser> selectAll(Vo vo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<FrontUser> frontUsers = zhucheMapper.selectAll(vo, pageNum, pageSize);
        PageInfo<FrontUser> frontUserPageInfo = new PageInfo<>(frontUsers);
        Pojo<FrontUser> frontUserPojo = new Pojo<>();
        frontUserPojo.setRows(frontUserPageInfo.getList());
        frontUserPojo.setTotal(frontUserPageInfo.getTotal());
        return frontUserPojo;
    }

    @Override
    public Integer updateById9(FrontUser frontUser) {
       return zhucheMapper.updateById9(frontUser);
    }

    @Override
    public Integer updateById99(FrontUser frontUser) {
        return zhucheMapper.updateById99(frontUser);
    }


    //liyongchao
    @Override
    public FrontUser One(int uid) {
        return zhucheMapper.One(uid);
    }
}
